<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    #box {
      width: 300px;
      height: 300px;
      background: red;
    }
  </style>
</head>

<body>
  <div id="box">
    <p>131231231213</p>
  </div>
  <form id="myform">
    <input type="submit">
  </form>
  <input type="text" id="mytxt">
  <script src="jquery-3.4.1.min.js"></script>
  <script>
    $("#box").mousemove(function (e) {
      // e.target 事件源  正在发生事件的具体元素
      var e = e || window.event;
      // console.log(e.target) //事件源  //ie  e.srcElement
      var target = e.target || e.srcElement;
      e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;//阻止冒泡
      // 相对于整个页面获取鼠标x轴和y轴位置 // e.pageX e.pageY
      console.log(e.pageX + "-----" + e.pageY)
      // e.clientX e.clientY 相对整个视口的 鼠标位置

    })
    $("#myform").submit(function (e) {
      e.preventDefault();//阻止默认行为
      //显示两次点击之间的时间。
      console.log(e.timeStamp)
      // timeStamp 时间戳
      console.log(new Date().getTime())//获取时间戳
      // return false//阻止默认行为
    })


    var mytxt = document.getElementById("mytxt");
    mytxt.onkeydown = function (e) {
      var e = e || window.event;
      var keyCode = e.keyCode || e.which;
      // enter 13 esc 27  ctrl 17 alt 18 shift 16  space 32
      console.log(keyCode)
    } 
  </script>
</body>

</html>